package com.soft.service;

import java.util.List;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

import com.soft.entity.Purchase;


@SpringBootTest
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public class PurchaseServiceTest {
    @Autowired
    private PurchaseService purchaseService;
    //@Test
	public void queryByUserNamePurchaseTotleTest() {
		List<Purchase> workerList = purchaseService.queryByUserNamePurchaseTotle("111");
		Assert.isTrue(workerList.size()==1,"错误");
	}
	//@Test      
	public void insertPurchaseTest() {
		int num = purchaseService.insertPurchase("444","2000","111");
		Assert.isTrue(num==1,"增加消费记录错误");
	}
	@Test
	public void updatePurchaseTest() {
		int num = purchaseService.updatePurchase("222","600","jz");
		Assert.isTrue(num==1,"修改总价错误");
	}
}
